package com.ys.erp.common.json;

import com.alibaba.fastjson2.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lwj
 * @date 2024/8/28
 */
public class YsJSONUtil {

    @SuppressWarnings("unchecked")
    public static <V> Map<String, V> toMap(JSONObject jsonObject) {
        // 或者使用JSONObject的iterator进行遍历
        HashMap<String, V> kvHashMap = new HashMap<>();
        for (String key : jsonObject.keySet()) {
            kvHashMap.put(key, (V)jsonObject.get(key));
        }
        return kvHashMap;
    }

}
